package com.lujieni.threadpool.listener;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextClosedEvent;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component;


@Component
public class ContextClosedHandler implements ApplicationListener<ContextClosedEvent> {

  @Autowired
  private ThreadPoolTaskExecutor fuckAsyncPool;

  @Override
  public void onApplicationEvent(ContextClosedEvent event) {
    // 执行你的业务逻辑
    fuckAsyncPool.shutdown();
    System.out.println("close event123");
  }


}

